#include "junix.h"
#include <tr1/unordered_set>
#include <boost/functional/hash.hpp>

#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>

using namespace std;

struct A
{
	int i;
	int j;

	A( int ii, int jj):i(ii), j(jj){ }

	friend size_t hash_value( const A& a)
	{
		size_t seed =0;
		boost::hash_combine(seed, a.i);
		boost::hash_combine(seed, a.j);

		return seed;
	}
};

bool operator== (const A& a,const A& b)
{
	return a.i==b.i && a.j==b.j;
}

int main(int argc, char **argv)
{
	srand(time(0));
	std::tr1::unordered_set<A, boost::hash<A> > sa;
	for(int i=0;i<20;i++)
	{
		A a(rand()%30, rand()%30);
		sa.insert(a);
	}

	using namespace boost::lambda;

	for_each( sa.begin(), sa.end(),
			cout<<bind(&A::i, _1)<<","<<bind(&A::j,_1)<<"\n");
}
